/*
 * @Descripttion:
 * @version:
 * @Author: congsir
 * @Date: 2023-12-19 19:44:05
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-12-21 19:07:01
 */
export const setItem = (key, value) => {
  // console.log(value)  
  if (typeof value === "object") {
    value = JSON.stringify(value);
  }
  window.localStorage.setItem(key, value);
};

// 获取
export const getItem = (key) => {
  const data = window.localStorage.getItem(key);
  try {
    return JSON.parse(data);
  } catch (error) {
    return data;
  }
};
// 删除
export const removeItem = (key) => {
  window.localStorage.removeItem(key);
};
